package com.qfedu.knowledge.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.qfedu.knowledge.dao.IQuestionRecordDao;
import com.qfedu.knowledge.entity.bo.QuestionRecordBO;
import com.qfedu.knowledge.entity.dto.BasePageDTO;
import com.qfedu.knowledge.entity.vo.PageResult;
import com.qfedu.knowledge.entity.vo.QuestionRecordVO;
import com.qfedu.knowledge.service.IQuestionRecordService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @ClassName QuestionRecordServiceImpl
 * @Author ykx
 * @Date 2024/1/23 10:18
 * @Version 1.0
 */
@Service
public class QuestionRecordServiceImpl extends ServiceImpl<IQuestionRecordDao, QuestionRecordBO> implements IQuestionRecordService {

    @Autowired
    private IQuestionRecordDao questionRecordDao;

    /**
     * 获取问题的修改记录
     *
     * @param questionId 题目单
     * @return List<QuestionRecordBO>
     */
    @Override
    public PageResult<QuestionRecordVO> getRecordsList(BasePageDTO basePageDTO, Long questionId) {
        PageHelper.startPage(basePageDTO.getPage(), basePageDTO.getSize());
        return new PageResult<>(new PageInfo<>(questionRecordDao.getRecordByQuestionId(questionId)));
    }
}
